from nodetypes.ntypes.Document.view.RDF import Transform, Document


class Document(Document):
    
    def getRelatedStatements(self, context, consumer, driver, locale):
        return self.getFileStatements(
            context,
            super(Document,self).getRelatedStatements(
                context, consumer, driver, locale
            ),
            driver,
            locale
        )
        
    def getFileStatements(self, context, consumer, driver, locale):
        model = context.model
        consumer(model.rdf_toStatements('dcSource'))
        for n in model.dcSource:
            consumer(n.rdf_toStatements('dcFormat'))
        
        return consumer
    
    
class Transform(Transform):
    
    newDocument = Document